<template>
	<div>
		<Banner :propBanner="Bannerlist"></Banner>
		<Types :propTypes="Typeslist"></Types>
		<Tabs :propTabs="Tabslist"></Tabs>
		<Short></Short>
		<Spike :propSpike="Spikelist"></Spike>
		<Minority :propMinority="Minoritylist"></Minority>
		<Destination></Destination>
		<Travel></Travel>
		
		<GuideReg></GuideReg>
		<Buttom :propurl="arrUrl"></Buttom>
	</div>
</template>

<script>
	import {mapState} from 'vuex'
	
	import Banner from './Banner/Banner'
	import Types from './Banner/Types'
	import Tabs from './Banner/Tabs'
	import Short from './Banner/Short'
	import Spike from './Banner/Spike'
	import Minority from './Banner/Minority'
	import Destination from './Banner/Destination'
	import Travel from './Banner/Travel'
	
	import GuideReg from './Banner/GuideReg'
	import Buttom from '../default/Buttom'
	
	export default{
		name:'Home',
		components:{Banner,Types,Tabs,Short,Spike,Minority,Destination,Travel,GuideReg,Buttom},
		data(){
			return{
				arrUrl:['img/home.png','img/o-order.png','img/o-user.png'],
				Bannerlist:[],
				Typeslist:[],
				Tabslist:[],
				Spikelist:[],
				Minoritylist:[]
			}
		},
		created() {
			let that=this//备份
			this.axios.get('api/dataHome.json').then((res)=>{
				let data=res.data.Homemsg[that.cityid]
				that.Bannerlist=data.BannerVuelist
				that.Typeslist=data.TypesVuelist
				that.Tabslist=data.TabsVuelist
				that.Spikelist=data.SpikeVuelist
				that.Minoritylist=data.MinorityVuelist
			}).catch((error)=>{
				console.log(error)
			})
		},
		computed:{
			...mapState(['cityid'])
		},
		watch:{
			cityid(){
				let that=this//备份
				console.log(that.cityid)
				this.axios.get('/api/dataHome.json').then((res)=>{
					let data=res.data.Homemsg[that.cityid]
					that.bannerlist=data.BannerVuelist
					that.spikelist=data.SpikeVuelist
					that.iconslist=data.IconsVuelist
					that.tabslist=data.TabsVuelist
					that.SlideTxtlist=data.SlideTxtVuelist
					that.swiperlist=data.SwiperOneVuelist
				}).catch((error)=>{
					console.log(error)
				})
			}
		}
	}
</script>

<style>
</style>
